package com.example.myapplication

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.ViewGroup
import android.widget.Button
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity


class MyActivity: AppCompatActivity() {
    @SuppressLint("MissingInflatedId")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val linearLayout=LinearLayout(this)
        linearLayout.orientation=LinearLayout.VERTICAL

        val textView=TextView(this)

        textView.layoutParams=ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT
,ViewGroup.LayoutParams.WRAP_CONTENT)
        textView.textSize=30F
        textView.text=getString(R.string.testView)
        linearLayout.addView(textView)

        val button=Button(this)
        button.width=ViewGroup.LayoutParams.MATCH_PARENT
        button.height=ViewGroup.LayoutParams.WRAP_CONTENT
        button.text=getString(R.string.button)
        linearLayout.addView(button)

        setContentView(linearLayout)
        
    //        setContentView(R.layout.activity_main)
//        val button= findViewById<Button>(R.id.button)
//        val textView= findViewById<TextView>(R.id.textView)
        button.setOnClickListener{
            textView.text=getString(R.string.clicked)
        }
    }
}